package com.ai.langchain4j.assistant;

import dev.langchain4j.service.MemoryId;
import dev.langchain4j.service.SystemMessage;
import dev.langchain4j.service.UserMessage;
import dev.langchain4j.service.spring.AiService;

import static dev.langchain4j.service.spring.AiServiceWiringMode.EXPLICIT;

/**
 * @author 林
 * @create 2025-07-19 0:03
 */

@AiService(
        wiringMode = EXPLICIT,
        chatModel = "qwenChatModel",
        chatMemoryProvider = "chatMemoryProviderXiaozhi",
        tools = {"appointmentTools"}, // 配置多个工具类
        contentRetriever = "contentRetrieverXiaozhi" //配置向量存储
)

//用户提问 →
//[contentRetriever 检索向量库] →
//[chatMemoryProvider 获取对话历史] →
//[chatModel 综合信息，判断是否调用工具] →
//  若需要 → [tools 执行工具调用（如Redis→接口）] →
//[chatModel 整理结果，返回回答]
public interface XiaozhiAgent {

    /**
     * @param memoryId 为一次的记忆id
     * @param userMessage 用户发送的消息
     * @return
     */
    //系统提示消息读取这个文件
    @SystemMessage(fromResource = "zhaozhi-prompt-template.txt")
    String chat(@MemoryId Long memoryId, @UserMessage String userMessage);
}
